# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=simplesnap
pkgver=1.0.4
pkgrel=2
pkgdesc="Simple and powerful network transmission of ZFS snapshots"
url="https://github.com/jgoerzen/simplesnap"
arch="noarch !armhf !armv7" # limited by zfs
license="GPL-3.0-or-later"
depends="bash coreutils liblockfile openssh-client zfs"
subpackages="$pkgname-doc"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/jgoerzen/simplesnap/archive/release/$pkgver.tar.gz
	0001-fix-simplesnap-line-2-dotlockfile-command-not-found.patch
	0002-trap-do-not-define-ECODE-at-setup.patch
	0003-use-CHECKHOST-in-checkbackups-function.patch
	"
builddir="$srcdir/$pkgname-release-$pkgver"

prepare() {
	default_prepare

	sed -i 's|sbin/zfs|usr/&|' simplesnap
	sed -i 's|sbin/zfs|usr/&|' simplesnapwrap
}

package() {
	install -m 0755 -d "$pkgdir"/usr/sbin
	install -m 0755 simplesnap  "$pkgdir"/usr/sbin/
	install -m 0755 simplesnapwrap "$pkgdir"/usr/sbin/

	install -m 0755 -d "$pkgdir"/usr/share/man/man8
	install -m 0644 doc/simplesnap.8 "$pkgdir"/usr/share/man/man8/
}

sha512sums="818f917d65b87366af1530441f2c070a51e34efbf7790509f00aa18949dae4f8f5b1bbde4b67ca45f95df4ea816f42416c9f09aba060769d3548eb5f12551b62  simplesnap-1.0.4.tar.gz
54273ec9630cc5e764db65361ac4a03e27dafcbbe67794053e8a94584e7e8ed10db908b0285485a80253cf93bb7daf9f5257924a1476ab235138c88abb0111b7  0001-fix-simplesnap-line-2-dotlockfile-command-not-found.patch
618fd1ed200ae30437528a52090bf4363ba7f3641741865fb78ef67401fbde41a77fe83681d9c26a2391b7be6c25d22ba4285922911c28a1d0b7c4b093a19df7  0002-trap-do-not-define-ECODE-at-setup.patch
49248602dbbdb22ae1ac224f716e71165320184941434e968c214e969e26a8dbbfe6058a6af56684b31b51440817ef9fe874e64fa793a32713e5d3a644def73b  0003-use-CHECKHOST-in-checkbackups-function.patch"
